<template>
  <div class="waiwei" @click="jrlt(ddata)">
    <van-image round :src="ddata.titleImg" class="asdas" />
    <div class="xx">
      <div style="margin-bottom: 10px">
        <span class="mzi">{{ ddata.friendName }}</span>
      </div>
      <div>
        <span>{{ xiaoxi }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "XiTongxiaoxi",
  props: ["ddata"],
  methods: {
    // /进入好友聊天页面
    jrlt(ddata) {
      console.log(ddata);
      this.$router
        .push({
          name: "chat",
          params: {
            ddata:ddata,
          },
        })
        .catch((r) => {});
    },
  },
  computed: {
    xiaoxi() {
      if (
        this.ddata.chattingRecords[0].allMessage[0].xiaoxineirong.length > 14
      ) {
        return (
          this.ddata.chattingRecords[0].allMessage[0].xiaoxineirong.slice(
            0,
            14
          ) + "..."
        );
      } else {
        return this.ddata.chattingRecords[0].allMessage[0].xiaoxineirong;
      }
    },
  },
};
</script>

<style scoped>
.waiwei {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin: 5px 10px;
  background-color: rgba(255, 250, 250, 0.623);
  height: 8vh;
  align-items: center;
  border-radius: 10px;
  border: 1px rgba(231, 231, 231, 0.712) solid;
}
.xx {
  display: flex;
  flex-direction: column;
  width: 70%;
}
.asdas {
  width: 17%;
  margin: 0 3px;
}
.mzi {
  font-size: 20px;
  font-weight: 600;
}
</style>